package com.jmc.calls;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Properties;

public class CallRpg {
	
	public static void main(String[] args) {

		//Connection Variables
		/*
		String AS400_ADDRESS = "192.168.1.1";
		String AS400_USERNAME = "jmc";
		String AS400_PASSWORD = "jmc";
		String AS400_LIBRARY = "SASPERJAVA";
		*/
		
		String AS400_ADDRESS = "www.transfurlong.com.ar";
		String AS400_USERNAME = "qsecofer";
		String AS400_PASSWORD = "c2259";
		String AS400_LIBRARY = "TRFFILLIB";

		try {

		//START: Connection Block
		Class.forName("com.ibm.as400.access.AS400JDBCDriver");
		Properties prop = new Properties();
		prop.put("user", AS400_USERNAME);
		prop.put("password", AS400_PASSWORD);
		prop.put("prompt", "false");
		prop.put("errors", "full");
		Connection the400 = DriverManager.getConnection("jdbc:as400://" + AS400_ADDRESS , prop);
		the400.setAutoCommit(true);
		//END: Connection Block
		Statement stmt = the400.createStatement();
		//START: Run only if the Stored Procedure does not already exist
		try {
		
		stmt.executeUpdate("drop table TRFFILLIB.PD123456");
		stmt.close();
		the400.close();
		}
		catch (Exception ex) {
		ex.printStackTrace();
		
			//It already exists, do nothing
		}
		//END: Run only if the Stored Procedure does not already exist


		}
		catch (Exception ex) {
		ex.printStackTrace();
		}
		}
}
